﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Nop.Core.Domain.Orders;
using Nop.Web.Framework;
using Nop.Web.Framework.Mvc;

namespace Nop.Admin.Models.Invoice
{
    public partial class InvoiceModel : BaseNopEntityModel
    {
        public InvoiceModel()
        {
            AvailableCustomers = new List<SelectListItem>();
            AvailableTimeZones = new List<SelectListItem>();
            Orders = new List<InvoiceOrderModel>();
            AvailablePaymentMethods = new List<SelectListItem>();
        }
        //identifiers
        [NopResourceDisplayName("Admin.Invoice.Fields.ID")]
        public override int Id { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Guid")]
        public Guid? InvoiceGuid { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Number")]
        public string InvoiceNumber { get; set; }

        //customer info
        [NopResourceDisplayName("Admin.Invoice.Fields.Customer")]
        public int CustomerId { get; set; }
        //TODO: combine same string resources
        [NopResourceDisplayName("Admin.Invoice.Fields.CustomerEmail")]
        public string CustomerEmail { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.BillingEmail")]
        public string BillingEmail { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Name")]
        public string Name { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Status")]
        public string InvoiceStatus { get; set; }
        public int InvoiceStatusId { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Comment")]
        public string Comment { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.CreatedOn")]
        public DateTime? CreatedOn { get; set; }
        public string CreatedOnStr { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.DueDate")]
        [System.ComponentModel.DataAnnotations.UIHint("DateNullable")]
        public DateTime? DueDate { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.SubTotal")]
        public decimal SubTotal { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.FuelSurcharge")]
        public decimal? FuelSurcharge { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Tax")]
        public decimal Tax { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Total")]
        public decimal Total { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.Discount")]
        public decimal Discount { get; set; }
        [NopResourceDisplayName("Admin.Invoice.Fields.ChargePercentage")]
        public decimal ChargePercentage { get; set; }
        [NopResourceDisplayName("Admin.Orders.List.District")]
        public string District { get; set; }

        [NopResourceDisplayName("Admin.Invoice.Fields.TimeZoneId")]
        [AllowHtml]
        public string TimeZoneId { get; set; }


        //commerce invoice
        public int OrderKindId { get; set; }
        [NopResourceDisplayName("Admin.Orders.List.OrderKind")]
        public string OrderKindStr { get; set; }
        [NopResourceDisplayName("Admin.Catalog.Stores.Fields.Monthlycharge")]
        public decimal? MonthlyCharge { get; set; }
        [NopResourceDisplayName("Admin.Catalog.Stores.Fields.StorageCharge")]
        public decimal? StorageCharge { get; set; }
        [NopResourceDisplayName("Admin.Catalog.Stores.Fields.TransactionProcessingCharge")]
        public decimal? TransactionProcessingCharge { get; set; }
        [NopResourceDisplayName("Admin.Catalog.Stores.Fields.ServiceCharge")]
        public decimal? ServiceCharge { get; set; }

        public bool CanEditCustomer { get; set; }
        public bool CanEditInvoiceNumber { get; set; }
        public bool CanChangeStatus { get; set; }
        public string OrderIds { get; set; }

        // Invoice Creation interaction support
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; }

        public List<SelectListItem> AvailableCustomers { get; set; }
        public IList<SelectListItem> AvailableTimeZones { get; set; }
        public SelectList AvailableStatuses { get; set; }
        public List<InvoiceOrderModel> Orders { get; set; }

        //aggergator properties
        //public string AggregatorProfit { get; set; }
        public string AggregatorSubtotalExcltax { get; set; }
        public string AggregatorFuelSurcharge { get; set; }
        public string AggregatorTax { get; set; }
        public string AggregatorTotal { get; set; }

        public int? PaymentMethodId { get; set; }
        public List<SelectListItem> AvailablePaymentMethods { get; set; }

        //invoice notes
        [NopResourceDisplayName("Admin.Invoices.InvoiceNotes.Fields.AddInvoiceNoteDisplayToCustomer")]
        public bool AddInvoiceNoteDisplayToCustomer { get; set; }
        [NopResourceDisplayName("Admin.Invoices.InvoiceNotes.Fields.AddInvoiceNoteMessage")]
        [AllowHtml]
        public string AddInvoiceNoteMessage { get; set; }

        public bool DisplayPdfInvoice { get; set; }

        public string Payment { set; get; }

        public string PaymentActionName { set; get; }

        public string PaymentControllerName { set; get; }

        public RouteValueDictionary PaymentRoute { set; get; }

        public int? CreditCardId { set; get; }

        public partial class InvoiceNote : BaseNopEntityModel
        {
            public int InvoiceId { get; set; }
            [NopResourceDisplayName("Admin.Invoice.InvoiceNotes.Fields.DisplayToCustomer")]
            public bool DisplayToCustomer { get; set; }
            [NopResourceDisplayName("Admin.Invoice.InvoiceNotes.Fields.Note")]
            public string Note { get; set; }
            [NopResourceDisplayName("Admin.Invoice.InvoiceNotes.Fields.CreatedOn")]
            public DateTime CreatedOn { get; set; }
            public string CreatedOnStr { get; set; }
        }
    }
}